from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend


class UserModelBackend(ModelBackend):
    """
    自定义验证后端
    """

    def authenticate(self, request, username=None, password=None, **kwargs):
        # try:
        #     get_user_model().objects.get(username=username, is_superuser=True)
        # except:
        #     return None
        return super().authenticate(request, username, password, **kwargs)
